package com.flashmoment.video.controller;

import java.util.Arrays;
import java.util.Map;

import com.flashmoment.video.utils.PageUtils;
import com.flashmoment.video.utils.R;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.CrossOrigin;

import com.flashmoment.video.entity.UserConcernsEntity;
import com.flashmoment.video.service.UserConcernsService;




/**
 * 用户关注表
 *
 * @author xulu
 * @email 1435533194@qq.com
 * @date 2023-10-24 16:35:33
 */
@RestController
@RequestMapping("video/userconcerns")
@CrossOrigin
@Api(tags = "用户关注接口")
public class UserConcernsController {
    @Autowired
    private UserConcernsService userConcernsService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = userConcernsService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Integer id){
		UserConcernsEntity userConcerns = userConcernsService.getById(id);

        return R.ok().put("userConcerns", userConcerns);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody UserConcernsEntity userConcerns){
		userConcernsService.save(userConcerns);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody UserConcernsEntity userConcerns){
		userConcernsService.updateById(userConcerns);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Integer[] ids){
		userConcernsService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
